home *** CD-ROM | disk | FTP | other *** search
- Path: erich.triumf.ca!bennett
- From: bennett@erich.triumf.ca (P.Bennett)
- Newsgroups: comp.lang.c
- Subject: Re: Float to String
- Date: 23 Mar 1996 09:37 PST
- Organization: TRIUMF: Tri-University Meson Facility
- Distribution: world
- Message-ID: <23MAR199609371746@erich.triumf.ca>
- References: <4is29s$h1a@dfw-ixnews6.ix.netcom.com> <4j0m8a$1mem@darkwing.cadvision.com>
- NNTP-Posting-Host: ftp.triumf.ca
- News-Software: VAX/VMS VNEWS 1.50
-
- In article <4j0m8a$1mem@darkwing.cadvision.com>, douglasd@cadvision.com (Doran Douglas) writes...
- >scoshe@ix.netcom.com(Christopher Scott Shelton ) wrote:
- >
- >>Is it possible to convert a float to a string? like the itoa function.
- >try strcpy 'ing the float to a string array
- >eg strcpy(string, float_variable_name);
-
- WHAT!!!!!
-
- This is highly unlikely to do anything useful. It will more likely do
- something _extremely_ unpleasant. strcpy() will copy bytes from the float
- into the string, until it finds a zero byte. It _will_ _not_ convert the float
- to a readable string.
-
- Use sprintf()
-
- Peter Bennett VE7CEI | Vessels shall be deemed to be in sight
- Internet: bennett@triumf.ca | of one another only when one can be
- Packet: ve7cei@ve7kit.#vanc.bc.ca | observed visually from the other
- TRIUMF, Vancouver, B.C., Canada | ColRegs 3(k)
- GPS and NMEA info and programs: ftp://sundae.triumf.ca/pub/peter/index.html
- or: ftp://ftp-i2.informatik.rwth-aachen.de/pub/arnd/GPS/peter/index.html
-
-